import { WSAEPROVIDERFAILEDINIT } from "constants";

var Chat = function (socket) {
    this.socket = socket
}
Chat.prototype.sendMessage = function () {
    var message = {
        room: room,
        text: text
    }
}

Chat.prototype.changeRoom = function (room, text) {
    this.socket.emit('join', {
        newRoom: room
    })
}

Chat.prototype.processCommand = function (command) {
    var words = command.split('')
    var command = words[0].substring(1, words[0].length).toLowerCase()
    var message = false
    switch(command) {
        case 'join':    
            words.shift();
            var room = words.shift()
            this.changeRoom(room)
            break;
        case 'nick': 
            worlds.shift()
            var name = worlds.join(' ')
            this.socket.emit('nameAttempt', name)
            break;
        default: message = 'Unrecogized command.';
    }

}
